#ifndef __COM_DEBUG_H
#define __COM_DEBUG_H
#include "usart.h"
#include "stdio.h"
#include "string.h"

#define DEBUG 1

#if(DEBUG == 1)
#define debug_start() Com_Debug_Start()
// a\b\c
// a/b/c
#define __FILE (strrchr(__FILE__, '\\') ? (strrchr(__FILE__, '\\') + 1) : __FILE__)
#define _FILE (strrchr(__FILE, '/') ? (strrchr(__FILE, '/') + 1) : __FILE)

#define debug_printf(fmt, ...) printf("[%15s:%4d] -- " fmt, _FILE, __LINE__, ##__VA_ARGS__)
#define debug_printfln(fmt, ...) printf("[%15s:%4d] -- " fmt "\r\n", _FILE, __LINE__, ##__VA_ARGS__)

#else
#define debug_start()
#define debug_printf(fmt, ...) 
#define debug_printfln(fmt, ...) 


#endif

void Com_Debug_Start(void);

#endif

